/*
 *  WMovingObject.h
 *  GLRender
 *
 *  Created by Patrick zulian on 5/4/10.
 *  Copyright 2010 University  of Lugano. All rights reserved.
 *
 */

#ifndef W_MOVING_OBJECT_H
#define W_MOVING_OBJECT_H

#include "Base.h"
#include "WObject.h"
#include <vector>

class WMovingObject : public WObject {
protected:
	Point3d _velocity, _nextVelocity, _upperNormal;
	//std::vector< MovementListener * > listeners;
	double acceleration, accelerationFactor, alpha, beta, gamma, rotAngle, vertAngle;

protected:	
	bool collided;
	
public:
	WMovingObject(const Point3d &position, const Point3d &velocity0, const double _mass = 0.0, const double radius = 1.0);
	virtual
	~WMovingObject() { }
	
	//void fireMoved();
	//void addMovementListener(MovementListener *  listener);
	
	virtual
	void step(const double tau);
	
	
	const Point3d velocity() const 
	{
		return _velocity;
	}
	
	Point3d& velocity() 
	{
		return _velocity;
	}
	
	
	Point3d& nextVelocity() 
	{
		return _nextVelocity;
	}
	
	Point3d& upperNormal()
	{
		return _upperNormal;
	}
	
	double& rotationAngle(){
		return rotAngle;
	}
	
	double& verticalAngle(){
		return vertAngle;
	}
	
	void pitch(const double angle);
	
	void roll(const double angle);
	
	void yaw(const double angle);
	
	void speedUp();
	
	void speedDown();
	
	virtual
	double getMinSpeed() const
	{
		return 1.0;
	}
	
	virtual
	double getMaxSpeed() const 
	{
		return 100.0;
	}
};


#endif
